/**
 * @author Jeff
 * 
 * Frame for pop-up window to modify existing entry in database.
 * Fields are filled with existing data and can be modified.
 */

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gui;

import javax.swing.ButtonGroup;
import javax.swing.JOptionPane;
import javax.swing.JSeparator;

import model.DatabaseCommunicator;

/**
 *
 * @author Jeff
 */
public class ModifyEntryFrame extends javax.swing.JFrame {
	
	//Beer constructor
    public ModifyEntryFrame(String name, Double price, int proof, int numberDrank, String flavorings, String type) {
        initComponents();
        if(name != null){
        	nameTextField.setText(name);
        }
        wineRadio.setEnabled(false);
        liquorRadio.setEnabled(false);
        breweryRadio.setEnabled(false);
        wineryRadio.setEnabled(false);
        distilleryRadio.setEnabled(false);
        
        beerRadio.setSelected(true);
        priceField.setText("" + price);
        proofField.setText("" + proof);
        numberField.setText("" + numberDrank);
        flavoringsField.setText(flavorings);
        typeField.setText(type);
        

    	currentButton = beerRadio;
    	priceField.setEnabled(true);
    	proofField.setEnabled(true);
    	numberField.setEnabled(true);
    	flavoringsField.setEnabled(true);
    	pairingsField.setEnabled(false);
    	fruitCheckbox.setEnabled(false);
    	yearField.setEnabled(false);
    	distilledField.setEnabled(false);
    	typeField.setEnabled(true);
    	
    	yearEstField.setEnabled(false);
    	websiteField.setEnabled(false);
    	founderField.setEnabled(false);
    	microCheckbox.setEnabled(false);
    	productionField.setEnabled(false);
    	acresField.setEnabled(false);
    	makerField.setEnabled(false);
    }
    
  //Wine constructor
    public ModifyEntryFrame(String name, Double price, int proof, int numberDrank, String pairings, int fruitWine, int year, String type) {
        initComponents();
        if(name != null){
        	nameTextField.setText(name);
        }
        beerRadio.setEnabled(false);
        liquorRadio.setEnabled(false);
        breweryRadio.setEnabled(false);
        wineryRadio.setEnabled(false);
        distilleryRadio.setEnabled(false);
        
        wineRadio.setSelected(true);
        priceField.setText("" + price);
        proofField.setText("" + proof);
        numberField.setText("" + numberDrank);
        pairingsField.setText(pairings);
        fruitCheckbox.setSelected(true);
        if(fruitWine == 0){
        	fruitCheckbox.setSelected(false);
        }
        yearField.setText("" + year);
        typeField.setText(type);
        

    	currentButton = wineRadio;
    	priceField.setEnabled(true);
    	proofField.setEnabled(true);
    	numberField.setEnabled(true);
    	flavoringsField.setEnabled(false);
    	pairingsField.setEnabled(true);
    	fruitCheckbox.setEnabled(true);
    	yearField.setEnabled(true);
    	distilledField.setEnabled(false);
    	typeField.setEnabled(true);
    	
    	yearEstField.setEnabled(false);
    	websiteField.setEnabled(false);
    	founderField.setEnabled(false);
    	microCheckbox.setEnabled(false);
    	productionField.setEnabled(false);
    	acresField.setEnabled(false);
    	makerField.setEnabled(false);
    }
    
  //Spirit constructor
    public ModifyEntryFrame(String name, Double price, String distilledFrom, int proof, int numberDrank, String type) {
        initComponents();
        if(name != null){
        	nameTextField.setText(name);
        }
        wineRadio.setEnabled(false);
        beerRadio.setEnabled(false);
        breweryRadio.setEnabled(false);
        wineryRadio.setEnabled(false);
        distilleryRadio.setEnabled(false);
        
        liquorRadio.setSelected(true);
        priceField.setText("" + price);
        proofField.setText("" + proof);
        numberField.setText("" + numberDrank);
        distilledField.setText(distilledFrom);
        typeField.setText(type);
        
    	currentButton = liquorRadio;
    	priceField.setEnabled(true);
    	proofField.setEnabled(true);
    	numberField.setEnabled(true);
    	flavoringsField.setEnabled(false);
    	pairingsField.setEnabled(false);
    	fruitCheckbox.setEnabled(false);
    	yearField.setEnabled(false);
    	distilledField.setEnabled(true);
    	typeField.setEnabled(true);
    	
    	yearEstField.setEnabled(false);
    	websiteField.setEnabled(false);
    	founderField.setEnabled(false);
    	microCheckbox.setEnabled(false);
    	productionField.setEnabled(false);
    	acresField.setEnabled(false);
    	makerField.setEnabled(false);
    }
    
  //Brewery constructor
    public ModifyEntryFrame(String name, int yearEstablished, String website, int micro) {
        initComponents();
        if(name != null){
        	nameTextField.setText(name);
        }
        wineRadio.setEnabled(false);
        liquorRadio.setEnabled(false);
        beerRadio.setEnabled(false);
        wineryRadio.setEnabled(false);
        distilleryRadio.setEnabled(false);
        
        breweryRadio.setSelected(true);
        microCheckbox.setSelected(true);
        if(micro == 0){
        	microCheckbox.setSelected(false);
        }
        yearEstField.setText("" + yearEstablished);
        websiteField.setText(website);
        

    	currentButton = breweryRadio;
    	priceField.setEnabled(false);
    	proofField.setEnabled(false);
    	numberField.setEnabled(false);
    	flavoringsField.setEnabled(false);
    	pairingsField.setEnabled(false);
    	fruitCheckbox.setEnabled(false);
    	yearField.setEnabled(false);
    	distilledField.setEnabled(false);
    	typeField.setEnabled(false);
    	yearEstField.setEnabled(true);
    	websiteField.setEnabled(true);
    	founderField.setEnabled(false);
    	microCheckbox.setEnabled(true);
    	productionField.setEnabled(false);
    	acresField.setEnabled(false);
    	makerField.setEnabled(false);
    }
    
  //Winery constructor
    public ModifyEntryFrame(String name, int yearEstablished, String website, int currProd, String wineMaker, int acres) {
        initComponents();
        if(name != null){
        	nameTextField.setText(name);
        }
        

        wineRadio.setEnabled(false);
        liquorRadio.setEnabled(false);
        breweryRadio.setEnabled(false);
        beerRadio.setEnabled(false);
        distilleryRadio.setEnabled(false);
        
        wineryRadio.setSelected(true);
        yearEstField.setText("" + yearEstablished);
        websiteField.setText(website);
        productionField.setText("" + currProd);
        makerField.setText(wineMaker);
        acresField.setText("" + acres);
        

    	currentButton = wineryRadio;
    	priceField.setEnabled(false);
    	proofField.setEnabled(false);
    	typeField.setEnabled(false);
    	numberField.setEnabled(false);
    	flavoringsField.setEnabled(false);
    	pairingsField.setEnabled(false);
    	fruitCheckbox.setEnabled(false);
    	yearField.setEnabled(false);
    	distilledField.setEnabled(false);
    	yearEstField.setEnabled(true);
    	websiteField.setEnabled(true);
    	founderField.setEnabled(false);
    	microCheckbox.setEnabled(false);
    	productionField.setEnabled(true);
    	acresField.setEnabled(true);
    	makerField.setEnabled(true);
    }
    
    // distillery constructor
    public ModifyEntryFrame(String name, int yearEstablished, String website, String founder) {
        initComponents();
        if(name != null){
        	nameTextField.setText(name);
        }

        wineRadio.setEnabled(false);
        liquorRadio.setEnabled(false);
        breweryRadio.setEnabled(false);
        wineryRadio.setEnabled(false);
        beerRadio.setEnabled(false);
        
        distilleryRadio.setSelected(true);
        yearEstField.setText("" + yearEstablished);
        websiteField.setText(website);
        founderField.setText(founder);
        

    	currentButton = distilleryRadio;
    	priceField.setEnabled(false);
    	proofField.setEnabled(false);
    	numberField.setEnabled(false);
    	flavoringsField.setEnabled(false);
    	pairingsField.setEnabled(false);
    	fruitCheckbox.setEnabled(false);
    	yearField.setEnabled(false);
    	distilledField.setEnabled(false);
    	typeField.setEnabled(false);
    	yearEstField.setEnabled(true);
    	websiteField.setEnabled(true);
    	founderField.setEnabled(true);
    	microCheckbox.setEnabled(false);
    	productionField.setEnabled(false);
    	acresField.setEnabled(false);
    	makerField.setEnabled(false);
    }

    private void initComponents() {
        
        ButtonGroup group = new ButtonGroup();
        group.add(beerRadio);
        group.add(wineRadio);
        group.add(liquorRadio);
        group.add(breweryRadio);
        group.add(wineryRadio);
        group.add(distilleryRadio);

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);        
        
        // disable all buttons to start with
    	priceField.setEnabled(false);
    	proofField.setEnabled(false);
    	numberField.setEnabled(false);
    	flavoringsField.setEnabled(false);
    	pairingsField.setEnabled(false);
    	fruitCheckbox.setEnabled(false);
    	yearField.setEnabled(false);
    	distilledField.setEnabled(false);
    	typeField.setEnabled(false);
    	yearEstField.setEnabled(false);
    	websiteField.setEnabled(false);
    	founderField.setEnabled(false);
    	microCheckbox.setEnabled(false);
    	productionField.setEnabled(false);
    	acresField.setEnabled(false);
    	makerField.setEnabled(false);
        

        //default null values
    	priceField.setText(0 + "");
    	proofField.setText(0 + "");
    	numberField.setText(0 + "");
    	flavoringsField.setText("N/A");
    	pairingsField.setText("N/A");
    	yearField.setText("N/A");
    	distilledField.setText("N/A");
    	typeField.setText("N/A");
    	yearEstField.setText(0 + "");
    	websiteField.setText("N/A");
    	founderField.setText("N/A");
    	productionField.setText(0 + "");
    	acresField.setText(0 + "");
    	makerField.setText("N/A");
        
        
    	
        drinkTypeLabel.setText("Type:");
        
        typeLabel.setText("Class:");

        nameLabel.setText("Name:");

        beerRadio.setText("Beer");

        wineRadio.setText("Wine");

        liquorRadio.setText("Liquor");

        breweryRadio.setText("Brewery");

        wineryRadio.setText("Winery");

        distilleryRadio.setText("Distillery");

        drinksLabel.setText("Drinks");

        producersLabel.setText("Producers");

        priceLabel.setText("Price:");

        proofLabel.setText("Proof:");

        numDrankLabel.setText("Number Drank:");

        flavoringsLabel.setText("Flavorings:");

        pairingsLabel.setText("Pairings:");

        fruitLabel.setText("Fruit Wine:");
        
        yearLabel.setText("Year:");

        jSeparator2.setOrientation(javax.swing.SwingConstants.VERTICAL);

        fruitCheckbox.setText("Yes");


        distilledLabel.setText("Distilled From:");

        jSeparator3.setOrientation(javax.swing.SwingConstants.VERTICAL);

        yearEstablishedLabel.setText("Year Established: ");

        websiteLabel.setText("Website:");

        founderLabel.setText("Founder:");

        microLabel.setText("Micro Brewery:");

        microCheckbox.setText("Yes");

        productionLabel.setText("Current Production:");

        acresLabel.setText("Acres:");

        winemakerLabel.setText("Wine Maker:");

        submitButton.setText("Submit");
        submitButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
            	// All of these will be defaults for attributes at least the name
            	// and table name will be changed so the create should always work
            	// as long as there is a value in the name field
            	String tableName = "NA";
            	String name = nameTextField.getText();
            	String specificValues = "NA";
            	
            	if(name.length() != 0){
                	if(!beerRadio.isSelected() && !wineRadio.isSelected() && !liquorRadio.isSelected()
                			&& !wineryRadio.isSelected() && !breweryRadio.isSelected() && !distilleryRadio.isSelected()){
                    	JOptionPane.showMessageDialog(ModifyEntryFrame.this, "Please select a Class.");
                    }
	            	if(breweryRadio.isSelected() || wineryRadio.isSelected() || distilleryRadio.isSelected()){
	            		int yearEstablished = Integer.parseInt(yearEstField.getText());
	            		String website = websiteField.getText();
	            		
	                	if (currentButton.equals(breweryRadio)){
	                		tableName = "brewery";
	                		int microMacro;
	                		if (fruitCheckbox.isSelected()){
	                			microMacro = 1;
	                		} else {
	                			microMacro = 0;
	                		}
	                		specificValues = " microMacro = '" + microMacro;
	                		
	                	} else if (currentButton.equals(wineryRadio)){
	                		tableName = "winery";
	                		int currentProduction = Integer.parseInt(productionField.getText());
	                		int acres = Integer.parseInt(acresField.getText());
	                		String wineMaker = makerField.getText();
	                		specificValues = "currentProduction = '"+currentProduction +
	                				"', acres = '"+ acres +"', wineMaker = '"+
	                							wineMaker;
	                		
	                	} else if (currentButton.equals(distilleryRadio)){
	                		tableName = "distillery";
	                		String founder = founderField.getText();
	                		specificValues = "founder = '" + founder;
	                		
	                	} else {
	                		System.out.println("Should never reach here - Producers");
	                	}
	                	
	            		String stmt = "UPDATE IGNORE"+ tableName + " SET name =" +"'"+ name +
	            				"', yearEstablished = '"+ yearEstablished +"', website = '"+ website +
	            				"',"+ specificValues + "'";
	            		DatabaseCommunicator.dbc.update(stmt);
	            		
	            	}
	            	else{
	                	String type = "NA";
	            		Double price = Double.parseDouble(priceField.getText());
	            		type = typeField.getText();
	            		int numberDrank = Integer.parseInt(numberField.getText());
	            		int proof = Integer.parseInt(proofField.getText());
	            		
	                	if (currentButton.equals(beerRadio)){
	                		tableName = "beer";
	                		String flavorings = flavoringsField.getText();
	                		specificValues = "flavorings = '"+flavorings;
	                		
	                	} else if (currentButton.equals(wineRadio)){
	                		tableName = "wine";
	                		int fruitWine;
	                		int year = Integer.parseInt(yearField.getText());
	                		if (fruitCheckbox.isSelected()){
	                			fruitWine = 1;
	                		} else {
	                			fruitWine = 0;
	                		}
	                		String pairings = pairingsField.getText();
	                		specificValues = "year = '"+ year +"', fruitWine = '"+ fruitWine +
	                				"', pairings ='"+ pairings;
	                		
	                	} else if (currentButton.equals(liquorRadio)){
	                		tableName = "spirit";
	                		String distilledFrom = distilledField.getText();
	                		specificValues = "distilledFrom ='"+distilledFrom;
	                	
	                	} else {
	                		System.out.println("Should never reach here - drinks");
	                	}
	                	
	            		String stmt = "UPDATE "+ tableName + " SET name ='"+ name +
	            				"', price ='"+ price +"', type ='"+ type +"', numberDrank ='"+ 
	            				numberDrank +"', proof ='"+ proof +"',"+ specificValues + "'";
	            		DatabaseCommunicator.dbc.update(stmt);
	            		
	            	}
	        		dispose();
	            }
            	else if(name.length() == 0){
                	JOptionPane.showMessageDialog(ModifyEntryFrame.this, "Please enter a Name.");
                }
            }
        });
        
        beerRadio.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
            	currentButton = beerRadio;
            	priceField.setEnabled(true);
            	proofField.setEnabled(true);
            	numberField.setEnabled(true);
            	flavoringsField.setEnabled(true);
            	pairingsField.setEnabled(false);
            	fruitCheckbox.setEnabled(false);
            	yearField.setEnabled(false);
            	distilledField.setEnabled(false);
            	typeField.setEnabled(true);
            	
            	yearEstField.setEnabled(false);
            	websiteField.setEnabled(false);
            	founderField.setEnabled(false);
            	microCheckbox.setEnabled(false);
            	productionField.setEnabled(false);
            	acresField.setEnabled(false);
            	makerField.setEnabled(false);
            }
        });
        
        wineRadio.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
            	currentButton = wineRadio;
            	priceField.setEnabled(true);
            	proofField.setEnabled(true);
            	numberField.setEnabled(true);
            	flavoringsField.setEnabled(false);
            	pairingsField.setEnabled(true);
            	fruitCheckbox.setEnabled(true);
            	yearField.setEnabled(true);
            	distilledField.setEnabled(false);
            	typeField.setEnabled(true);
            	
            	yearEstField.setEnabled(false);
            	websiteField.setEnabled(false);
            	founderField.setEnabled(false);
            	microCheckbox.setEnabled(false);
            	productionField.setEnabled(false);
            	acresField.setEnabled(false);
            	makerField.setEnabled(false);
            }
        });
        
        liquorRadio.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
            	currentButton = liquorRadio;
            	priceField.setEnabled(true);
            	proofField.setEnabled(true);
            	numberField.setEnabled(true);
            	flavoringsField.setEnabled(false);
            	pairingsField.setEnabled(false);
            	fruitCheckbox.setEnabled(false);
            	yearField.setEnabled(false);
            	distilledField.setEnabled(true);
            	typeField.setEnabled(true);
            	
            	yearEstField.setEnabled(false);
            	websiteField.setEnabled(false);
            	founderField.setEnabled(false);
            	microCheckbox.setEnabled(false);
            	productionField.setEnabled(false);
            	acresField.setEnabled(false);
            	makerField.setEnabled(false);
            }
        });
        
        breweryRadio.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
            	currentButton = breweryRadio;
            	priceField.setEnabled(false);
            	proofField.setEnabled(false);
            	numberField.setEnabled(false);
            	flavoringsField.setEnabled(false);
            	pairingsField.setEnabled(false);
            	fruitCheckbox.setEnabled(false);
            	yearField.setEnabled(false);
            	distilledField.setEnabled(false);
            	typeField.setEnabled(false);
            	yearEstField.setEnabled(true);
            	websiteField.setEnabled(true);
            	founderField.setEnabled(false);
            	microCheckbox.setEnabled(true);
            	productionField.setEnabled(false);
            	acresField.setEnabled(false);
            	makerField.setEnabled(false);
            }
        });
        
        wineryRadio.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
            	currentButton = wineryRadio;
            	priceField.setEnabled(false);
            	proofField.setEnabled(false);
            	typeField.setEnabled(false);
            	numberField.setEnabled(false);
            	flavoringsField.setEnabled(false);
            	pairingsField.setEnabled(false);
            	fruitCheckbox.setEnabled(false);
            	yearField.setEnabled(false);
            	distilledField.setEnabled(false);
            	
            	yearEstField.setEnabled(true);
            	websiteField.setEnabled(true);
            	founderField.setEnabled(false);
            	microCheckbox.setEnabled(false);
            	productionField.setEnabled(true);
            	acresField.setEnabled(true);
            	makerField.setEnabled(true);
            }
            
        });
        
        distilleryRadio.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
            	currentButton = distilleryRadio;
            	priceField.setEnabled(false);
            	proofField.setEnabled(false);
            	numberField.setEnabled(false);
            	flavoringsField.setEnabled(false);
            	pairingsField.setEnabled(false);
            	fruitCheckbox.setEnabled(false);
            	yearField.setEnabled(false);
            	distilledField.setEnabled(false);
            	typeField.setEnabled(false);
            	yearEstField.setEnabled(true);
            	websiteField.setEnabled(true);
            	founderField.setEnabled(true);
            	microCheckbox.setEnabled(false);
            	productionField.setEnabled(false);
            	acresField.setEnabled(false);
            	makerField.setEnabled(false);
            }
        });



        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(nameLabel)
                                    .addComponent(typeLabel))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(layout.createSequentialGroup()
                                        .addComponent(nameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 114, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(submitButton))
                                    .addGroup(layout.createSequentialGroup()
                                        .addComponent(beerRadio)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addComponent(wineRadio)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(liquorRadio)
                                        .addGap(30, 30, 30)
                                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addGroup(layout.createSequentialGroup()
                                                .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 2, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                                    .addComponent(producersLabel)
                                                    .addGroup(layout.createSequentialGroup()
                                                        .addComponent(yearEstablishedLabel)
                                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                        .addComponent(yearEstField, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE))
                                                    .addGroup(layout.createSequentialGroup()
                                                        .addComponent(microLabel)
                                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                                        .addComponent(microCheckbox))
                                                    .addGroup(layout.createSequentialGroup()
                                                        .addComponent(winemakerLabel)
                                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                        .addComponent(makerField, javax.swing.GroupLayout.PREFERRED_SIZE, 56, javax.swing.GroupLayout.PREFERRED_SIZE))
                                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                                        .addGroup(layout.createSequentialGroup()
                                                            .addComponent(founderLabel)
                                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                            .addComponent(founderField))
                                                        .addGroup(layout.createSequentialGroup()
                                                            .addComponent(websiteLabel)
                                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                            .addComponent(websiteField, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                                    .addGroup(layout.createSequentialGroup()
                                                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                                            .addGroup(layout.createSequentialGroup()
                                                                .addComponent(acresLabel)
                                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                                .addComponent(acresField))
                                                            .addComponent(productionLabel))
                                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                        .addComponent(productionField, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE))))
                                            .addGroup(layout.createSequentialGroup()
                                                .addComponent(jSeparator3, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(breweryRadio)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                                .addComponent(wineryRadio)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(distilleryRadio)))
                                        .addGap(0, 145, Short.MAX_VALUE))))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(drinkTypeLabel)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(typeField, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(0, 0, Short.MAX_VALUE)))
                        .addContainerGap())
                    .addComponent(jSeparator1)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                                .addComponent(numDrankLabel)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(numberField, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                                .addComponent(pairingsLabel)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(pairingsField, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                                .addComponent(fruitLabel)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(fruitCheckbox))
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                                .addComponent(proofLabel)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(proofField))
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                                .addComponent(priceLabel)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(priceField, javax.swing.GroupLayout.PREFERRED_SIZE, 54, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(drinksLabel, javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                                .addComponent(flavoringsLabel)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(flavoringsField, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                                .addComponent(distilledLabel)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(distilledField))
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                                .addComponent(yearLabel)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(yearField, javax.swing.GroupLayout.PREFERRED_SIZE, 49, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(0, 0, Short.MAX_VALUE))))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(nameLabel)
                            .addComponent(nameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(submitButton))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(typeLabel)
                            .addComponent(beerRadio)
                            .addComponent(wineRadio)
                            .addComponent(liquorRadio)
                            .addComponent(jSeparator3)))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(breweryRadio)
                            .addComponent(wineryRadio)
                            .addComponent(distilleryRadio))))
                .addGap(18, 18, 18)
                .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(drinksLabel)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(priceLabel)
                            .addComponent(priceField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(proofLabel)
                            .addComponent(proofField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(numDrankLabel)
                            .addComponent(numberField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(flavoringsLabel)
                            .addComponent(flavoringsField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(pairingsLabel)
                            .addComponent(pairingsField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(fruitLabel)
                            .addComponent(fruitCheckbox))
                        .addGap(7, 7, 7)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(yearLabel)
                            .addComponent(yearField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(distilledLabel)
                            .addComponent(distilledField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 257, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGroup(layout.createSequentialGroup()
                            .addComponent(producersLabel)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(yearEstablishedLabel)
                                .addComponent(yearEstField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(websiteLabel)
                                .addComponent(websiteField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(founderLabel)
                                .addComponent(founderField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(microLabel)
                                .addComponent(microCheckbox))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(productionLabel)
                                .addComponent(productionField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(acresLabel)
                                .addComponent(acresField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(winemakerLabel)
                                .addComponent(makerField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(drinkTypeLabel)
                    .addComponent(typeField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(42, 42, 42))
        );

        pack();
    }// </editor-fold>       

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /*
         * Set the Nimbus look and feel
         */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /*
         * If Nimbus (introduced in Java SE 6) is not available, stay with the
         * default look and feel. For details see
         * http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(NewEntryFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(NewEntryFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(NewEntryFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(NewEntryFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /*
         * Create and display the form
         */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
               // new NewEntryFrame().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify
    private javax.swing.JRadioButton currentButton = new javax.swing.JRadioButton();
    private javax.swing.JTextField acresField = new javax.swing.JTextField();
    private javax.swing.JLabel acresLabel = new javax.swing.JLabel();
    private javax.swing.JRadioButton beerRadio = new javax.swing.JRadioButton();
    private javax.swing.JRadioButton breweryRadio = new javax.swing.JRadioButton();
    private javax.swing.JTextField distilledField = new javax.swing.JTextField();
    private javax.swing.JLabel distilledLabel = new javax.swing.JLabel();
    private javax.swing.JRadioButton distilleryRadio = new javax.swing.JRadioButton();
    private javax.swing.JLabel drinkTypeLabel = new javax.swing.JLabel();
    private javax.swing.JLabel drinksLabel = new javax.swing.JLabel();
    private javax.swing.JTextField flavoringsField = new javax.swing.JTextField();
    private javax.swing.JLabel flavoringsLabel = new javax.swing.JLabel();
    private javax.swing.JTextField founderField = new javax.swing.JTextField();
    private javax.swing.JLabel founderLabel = new javax.swing.JLabel();
    private javax.swing.JLabel fruitLabel = new javax.swing.JLabel();
    private javax.swing.JCheckBox fruitCheckbox = new javax.swing.JCheckBox();
    private javax.swing.JSeparator jSeparator1 = new javax.swing.JSeparator();
    private javax.swing.JSeparator jSeparator2 = new javax.swing.JSeparator();
    private javax.swing.JSeparator jSeparator3 = new javax.swing.JSeparator();
    private javax.swing.JRadioButton liquorRadio = new javax.swing.JRadioButton();
    private javax.swing.JTextField makerField = new javax.swing.JTextField();
    private javax.swing.JCheckBox microCheckbox = new javax.swing.JCheckBox();
    private javax.swing.JLabel microLabel = new javax.swing.JLabel();
    private javax.swing.JLabel nameLabel = new javax.swing.JLabel();
    private javax.swing.JTextField nameTextField = new javax.swing.JTextField();
    private javax.swing.JLabel numDrankLabel = new javax.swing.JLabel();
    private javax.swing.JTextField numberField = new javax.swing.JTextField();
    private javax.swing.JTextField pairingsField = new javax.swing.JTextField();
    private javax.swing.JLabel pairingsLabel = new javax.swing.JLabel();
    private javax.swing.JTextField priceField = new javax.swing.JTextField();
    private javax.swing.JLabel priceLabel = new javax.swing.JLabel();
    private javax.swing.JLabel producersLabel = new javax.swing.JLabel();
    private javax.swing.JTextField productionField = new javax.swing.JTextField();
    private javax.swing.JLabel productionLabel = new javax.swing.JLabel();
    private javax.swing.JTextField proofField = new javax.swing.JTextField();
    private javax.swing.JLabel proofLabel = new javax.swing.JLabel();
    private javax.swing.JButton submitButton = new javax.swing.JButton();
    private javax.swing.JTextField typeField = new javax.swing.JTextField();
    private javax.swing.JLabel typeLabel = new javax.swing.JLabel();
    private javax.swing.JTextField websiteField = new javax.swing.JTextField();
    private javax.swing.JLabel websiteLabel = new javax.swing.JLabel();
    private javax.swing.JRadioButton wineRadio = new javax.swing.JRadioButton();
    private javax.swing.JLabel winemakerLabel = new javax.swing.JLabel();
    private javax.swing.JRadioButton wineryRadio = new javax.swing.JRadioButton();
    private javax.swing.JTextField yearEstField = new javax.swing.JTextField();
    private javax.swing.JLabel yearEstablishedLabel = new javax.swing.JLabel();
    private javax.swing.JTextField yearField = new javax.swing.JTextField();
    private javax.swing.JLabel yearLabel = new javax.swing.JLabel();
    // End of variables declaration
}

